import requests
from requests import Response

url = 'http://httpbin.org/get'


def response_status(response: Response, *args, **kwargs):
    """响应 预处理 hook功能"""
    print(f"响应的url：{response.url}")
    response.status_code = 400


r1 = requests.request(
    method='get',
    url=url,
    hooks={'response': response_status}
)
print(r1.status_code)
